<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [
            "https://hbimg.huabanimg.com/193847048d627047a6401c01072ea8d1b4c020bda4593-kal2TL_fw240/format/webp",
            "https://hbimg.huabanimg.com/67f0a83beff314d5a0dc585f0d47422282c9029e9cd6-AYHPMT_fw240/format/webp",
            "https://hbimg.huabanimg.com/041a31bbd153920e7c0a5ebfc8f1c7a35ce215909c24b-GTLdG0_fw240/format/webp",
            "https://hbimg.huabanimg.com/093dfa8e67039a7a4326f8851892d65b83e0c1de17928-5rsm6P_fw240/format/webp",
            "https://hbimg.huabanimg.com/f6388969d7b64ddb6104fca8978ab446f18c9dd4d348-MYN7TG_fw240/format/webp",
        ];


        // 请使用JS加载这些图片 当这些图片都加载完毕 并且将这些图片按照顺序组一个数组 才游戏开始
        var count = 0;
        // 创建元素
        var imgArr = arr.map(function (src) {
            var img = new Image();
            img.src = src;
            img.onload = function () {
                count++;
                console.log(1)
                if (count === arr.length) {
                    console.log("游戏开始")
                }
            }
            return img;
        })
    </script>
</body>

</html>